package com.esri.core.symbol;

import android.graphics.Color;
import com.esri.core.internal.util.d;
import java.io.StringWriter;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonNode;

/* loaded from: classes.dex */
public class SimpleMarkerSymbol extends MarkerSymbol {
    public static final String TYPE = "esriSMS";
    private static final long serialVersionUID = 1;
    private int g;
    private SimpleLineSymbol h;
    private float i;
    private STYLE j;

    /* loaded from: classes.dex */
    public enum STYLE {
        CIRCLE("esriSMSCircle"),
        CROSS("esriSMSCross"),
        DIAMOND("esriSMSDiamond"),
        SQUARE("esriSMSSquare"),
        X("esriSMSX"),
        TRIANGLE("esriSMSTriangle");
        
        String a;

        STYLE(String str) {
            this.a = str;
        }

        public String getValue() {
            return this.a;
        }

        public static STYLE fromString(String str) {
            if ("esriSMSCircle".equals(str)) {
                return CIRCLE;
            }
            if ("esriSMSCross".equals(str)) {
                return CROSS;
            }
            if ("esriSMSDiamond".equals(str)) {
                return DIAMOND;
            }
            if ("esriSMSSquare".equals(str)) {
                return SQUARE;
            }
            if ("esriSMSX".equals(str)) {
                return X;
            }
            if ("esriSMSTriangle".equals(str)) {
                return TRIANGLE;
            }
            return null;
        }

        @Override // java.lang.Enum
        public String toString() {
            return this.a;
        }
    }

    public SimpleMarkerSymbol(JsonNode jsonNode) throws Exception {
        super(jsonNode);
        int argb = Color.argb(255, 255, 0, 0);
        this.g = argb;
        this.g = d.b(jsonNode, "color", argb);
        this.i = d.a(jsonNode, "size", (int) this.i);
        String a = d.a(jsonNode, "style");
        JsonNode jsonNode2 = jsonNode.get("outline");
        if (jsonNode2 != null) {
            this.h = new SimpleLineSymbol(jsonNode2);
        }
        if (a != null) {
            this.j = STYLE.fromString(a);
        }
    }

    public SimpleMarkerSymbol(int i, int i2, STYLE style) {
        this.g = Color.argb(255, 255, 0, 0);
        setColor(i);
        setSize(i2);
        setStyle(style);
    }

    public SimpleMarkerSymbol(SimpleMarkerSymbol simpleMarkerSymbol) throws Exception {
        super(simpleMarkerSymbol);
        this.g = Color.argb(255, 255, 0, 0);
        setColor(simpleMarkerSymbol.getColor());
        setSize(simpleMarkerSymbol.getSize());
        setStyle(simpleMarkerSymbol.getStyle());
        if (simpleMarkerSymbol.h != null) {
            this.h = (SimpleLineSymbol) simpleMarkerSymbol.getOutline().copy();
        } else {
            this.h = null;
        }
    }

    public int getColor() {
        return this.g;
    }

    public SimpleMarkerSymbol setColor(int i) {
        this.g = i;
        return this;
    }

    public float getSize() {
        return this.i;
    }

    public SimpleMarkerSymbol setSize(float f) {
        this.i = f;
        setWidth(f);
        setHeight(f);
        return this;
    }

    public STYLE getStyle() {
        return this.j;
    }

    public SimpleMarkerSymbol setStyle(STYLE style) {
        this.j = style;
        return this;
    }

    public SimpleLineSymbol getOutline() {
        return this.h;
    }

    public SimpleMarkerSymbol setOutline(SimpleLineSymbol simpleLineSymbol) {
        this.h = simpleLineSymbol;
        return this;
    }

    @Override // com.esri.core.symbol.Symbol
    public String toJson() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a = d.a(stringWriter);
        a.writeStartObject();
        d.a(a, "type", TYPE);
        super.a(a);
        d.b(a, "color", this.g);
        d.a(a, "size", (int) this.i);
        d.a(a, "style", this.j.getValue());
        if (this.h != null) {
            a.writeFieldName("outline");
            a.writeRaw(':');
            a.writeRaw(this.h.toJson());
        }
        a.writeEndObject();
        a.close();
        return stringWriter.toString();
    }

    @Override // com.esri.core.symbol.MarkerSymbol
    public int hashCode() {
        int hashCode = ((super.hashCode() * 31) + this.g) * 31;
        SimpleLineSymbol simpleLineSymbol = this.h;
        int hashCode2 = (((hashCode + (simpleLineSymbol == null ? 0 : simpleLineSymbol.hashCode())) * 31) + Float.floatToIntBits(this.i)) * 31;
        STYLE style = this.j;
        return hashCode2 + (style != null ? style.hashCode() : 0);
    }

    @Override // com.esri.core.symbol.MarkerSymbol
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (super.equals(obj) && getClass() == obj.getClass()) {
            SimpleMarkerSymbol simpleMarkerSymbol = (SimpleMarkerSymbol) obj;
            if (this.g != simpleMarkerSymbol.g) {
                return false;
            }
            SimpleLineSymbol simpleLineSymbol = this.h;
            if (simpleLineSymbol == null) {
                if (simpleMarkerSymbol.h != null) {
                    return false;
                }
            } else if (!simpleLineSymbol.equals(simpleMarkerSymbol.h)) {
                return false;
            }
            return Float.floatToIntBits(this.i) == Float.floatToIntBits(simpleMarkerSymbol.i) && this.j == simpleMarkerSymbol.j;
        }
        return false;
    }

    @Override // com.esri.core.symbol.Symbol
    public Symbol copy() throws Exception {
        return new SimpleMarkerSymbol(this);
    }
}
